package com.zj.eswrapper;

import com.zj.eswrapper.wrapper.EsQueryWrapper;

/**
 * @author arthur_zhou
 * @date 2024/1/29 11:04
 */
public class QueryUtils {
    public static void main(String[] args) {
        MiddlewareQueryBuilderImpl middlewareQueryBuilder = new MiddlewareQueryBuilderImpl();
        EsQueryWrapper<?> wrapper = middlewareQueryBuilder.query("{\n" +
                "  \"key\": {\n" +
                "    \"query\": \"上海水泥\",\n" +
                "    \"default_operator\": \"AND\",\n" +
                "    \"fields\": [\n" +
                "      {\n" +
                "        \"field\": \"name\",\n" +
                "        \"weight\": 10\n" +
                "      }\n" +
                "    ]\n" +
                "  },\n" +
                        "    \"filter\": {\"and\":[{\"term\": {\"industry_chain_id\": \"100fc2dadaca3b2d692d9fb11a6c8fd1\"}},\n" +
                        "{\"exists\": {\"field\": \"start_date\"}},\n" +
                        "{\"terms\": {\"label.label_code\": [\"10201020\",\"10201015\",\"10201027\",\"10201028\",\"01002003\",\"10201001\",\"10201002\",\"zslabel200100000000\",\"zslabel200200000000\",\"zslabel200300000000\",\"zslabel200400000000\",\"zslabel200500000000\",\"zslabel200600000000\",\"10201061\",\"10201062\",\"10201063\",\"10201055\",\"10201056\",\"10201075\",\"10201076\",\"10201077\",\"10201078\",\"10201048\",\"10201049\",\"zslabel400100000000\",\"10101021\",\"10101010\",\"10101011\",\"10101004\",\"10101019\",\"zslabel400110010000\",\"zslabel400110020000\",\"zslabel400110030000\",\"zslabel400110040000\",\"zslabel400110050000\",\"zslabel400110060000\",\"zslabel400110070000\",\"10104002\",\"10104024\",\"zslabel200700000000\",\"zslabel200800000000\"]}},\n" +
                        "{\"term\": {\"city_code_zc\": \"440300\"}},\n" +
                        "{\n" +
                        "  \"distance_range\": {\n" +
                        "    \"gd_location\": {\n" +
                        "      \"from\":12,\n" +
                        "      \"to\":500,\n" +
                        "      \"lon\": 121.44,\n" +
                        "      \"lat\": 31.294\n" +
                        "    }\n" +
                        "  }\n" +
                        "}," +
                        "{\n" +
                        "  \"graph\": {\n" +
                        "    \"field\": \"gd_location\",\n" +
                        "    \"points\": [\n" +
                        "      {\n" +
                        "        \"lon\": 120.2,\n" +
                        "        \"lat\": 30.2\n" +
                        "      },\n" +
                        "      {\n" +
                        "        \"lon\": 120.4,\n" +
                        "        \"lat\": 30.3\n" +
                        "      },\n" +
                        "      {\n" +
                        "        \"lon\": 120.5,\n" +
                        "        \"lat\": 30.1\n" +
                        "      },\n" +
                        "      {\n" +
                        "        \"lon\": 120.2,\n" +
                        "        \"lat\": 30.2\n" +
                        "      }\n" +
                        "    ]\n" +
                        "  }\n" +
                        "}\n" +
                        ",{\"range\": {\"regist_capi_w\": {\"gte\": 100001}}}\n" +
                        "\n" +
                        "]}\n" +
                        "}");
        System.out.println(wrapper.queryBuilder());
    }
}
